package com.gan.simple_init.config;

import lombok.Data;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author gbw
 * @date 2023/8/17
 * Redisson 限流
 */
@Configuration
@Data
public class RedissonConfig {

    // todo 修改配置
    @Bean
    public RedissonClient redissonClient(){
        Config config = new Config();
        config.useSingleServer()
                .setAddress("redis://101.42.251.184:6379")
                .setPassword("123456")
                .setDatabase(0);
        RedissonClient redissonClient = Redisson.create(config);
        return redissonClient;
    }
}
